<<<<<<< HEAD
// Computer类，表示电脑的配置
class Computer {
    private String brand;
    private String model;
    private int ram; // 内存，单位：GB
    private int storage; // 存储，单位：GB
    private String cpu; // CPU型号

    // 构造方法，初始化电脑配置
    public Computer(String brand, String model, int ram, int storage, String cpu) {
        this.brand = brand;
        this.model = model;
        this.ram = ram;
        this.storage = storage;
        this.cpu = cpu;
    }

    // 获取电脑配置信息的字符串表示
    @Override
    public String toString() {
        return "Computer [Brand: " + brand + ", Model: " + model + ", RAM: " + ram + "GB, Storage: " + storage + "GB, CPU: " + cpu + "]";
    }
}

// Student类，表示学生
class Student {
    private String name;
    private Computer computer; // 学生使用的电脑

    // 构造方法，初始化学生姓名和电脑
    public Student(String name, Computer computer) {
        this.name = name;
        this.computer = computer;
    }

    // 获取学生姓名
    public String getName() {
        return name;
    }

    // 获取学生使用的电脑
    public Computer getComputer() {
        return computer;
    }
}

// 主程序
public class Main {
    public static void main(String[] args) {
        // 实例化几台电脑
        Computer computer1 = new Computer("Dell", "XPS 13", 8, 256, "Intel i5");
        Computer computer2 = new Computer("Apple", "MacBook Air", 16, 512, "Apple M1");
        Computer computer3 = new Computer("Lenovo", "ThinkPad T14", 16, 1024, "Intel i7");
        // 可以根据需要实例化更多电脑...

        // 实例化几名学生并分配电脑
        Student student1 = new Student("Alice", computer1);
        Student student2 = new Student("Bob", computer2);
        Student student3 = new Student("Charlie", computer3);
        // 可以根据需要实例化更多学生...

        // 输出每个学生的电脑配置
        System.out.println(student1.getName() + "'s computer: " + student1.getComputer());
        System.out.println(student2.getName() + "'s computer: " + student2.getComputer());
        System.out.println(student3.getName() + "'s computer: " + student3.getComputer());
=======
public class Main {
    public static void main(String[] args) {
        f(1, 2);
        f(-1, -2, -3, -4); // 给参数传值时，实参的个数很灵活
        f(9, 7, 6);
    }

    public static void f(int... x) {
        // x是可变参数的代表，代表若干个int型参数
        for (int j : x) {
            // x.length是x代表的参数的个数
            System.out.println(j); // x[i]是x代表的第i个参数（类似数组）
        }
>>>>>>> fb45495 (这段代码演示了Java中可变参数的使用。可变参数允许方法接受不确定的参数。在这个例子中，我们定义了一个方法f，它接受可变参数量的int参数。x是可变参数的代表，它可以代表任意数量的int型参数。)
    }
}